#ifndef SENSERTOOLS_H
#define SENSERTOOLS_H

#include <QMainWindow>
#include <QSerialPort>
#include <QSerialPortInfo>
#include <QMessageBox>
#include <QThread>
#include <QDebug>
#include <QComboBox>
#include <QString>

#include <thread>

#include "datasingleton.h"
#include "serialop.h"

using std::thread;

namespace Ui {
class SenserTools;
}

class SenserTools : public QMainWindow
{
    Q_OBJECT

public:
    explicit SenserTools(QWidget *parent = nullptr);
    ~SenserTools();

    void getSerailInfo();
    void setBaudInfo();
    void setDeviceNameInfo();
    void setDeviceTypeInfo();
    void uartDataTextShow(QString str);

    QSerialPort *uart_port_;
    QThread serail_work_thread_;
    SerialOp serail_op_;

signals:
    void openSerialPort(QString serail_str);
    void setSerailParams(qint32 baudRate, QSerialPort::DataBits dataBits,\
                         QSerialPort::Parity parity, QSerialPort::StopBits stopbits,\
                         QSerialPort::FlowControl fc);
public slots:
    void onSerialPortOpenResult(bool success);

private:
    Ui::SenserTools *ui;
};

#endif // SENSERTOOLS_H
